package com.exam.Service;

import com.exam.Dao.ITestDao;
import com.exam.Domain.Question;
import com.exam.Domain.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName TestService
 * @Description
 * @Author JY
 * @Date 2020/6/3 12:51
 **/
@Service
public class TestService implements ITestDao {
    @Autowired
    private ITestDao iTestDao;
    @Override
    public List<Test> findAllTest() {
        return iTestDao.findAllTest();
    }

    @Override
    public List<Question> findQuestionList(String testId) {
        return iTestDao.findQuestionList(testId);
    }

    @Override
    public Test findTestById(String testId) {
        return iTestDao.findTestById(testId);
    }

    @Override
    public void updateTestAndQuest(String result, String userId, String testId, String questionId) {
            iTestDao.updateTestAndQuest(result,userId,testId,questionId);
    }

    @Override
    public void insertTestAndQuest(String result, String userId, String testId, String questionId) {
        iTestDao.insertTestAndQuest(result,userId,testId,questionId);
    }

    @Override
    public String findResult(String userId, String testId, String questionId) {
        return iTestDao.findResult(userId,testId,questionId);
    }

    @Override
    public List<Question> findQuestionById(String testId, String userId) {
        return iTestDao.findQuestionById(testId,userId);
    }

    @Override
    public List<Question> findTrueResult(String testId) {
        return iTestDao.findTrueResult(testId);
    }

    @Override
    public void insertInitScore(String userId, String testId) {
        iTestDao.insertInitScore(userId,testId);
    }

    @Override
    public void updateScore(String userId, String testId,int all) {
        iTestDao.updateScore(userId,testId,all);
    }

    @Override
    public int findExitScore(String userId, String testId) {
        return iTestDao.findExitScore(userId,testId);
    }

    @Override
    public List<Test> findTestByUser(String userId) {
        return iTestDao.findTestByUser(userId);
    }

    @Override
    public int findIfExist(String userId, String testId) {
        return iTestDao.findIfExist(userId,testId);
    }

    @Override
    public String findQuestionSolution(String testId,String questionId) {
        return iTestDao.findQuestionSolution(testId,questionId);
    }

    @Override
    public int findQuestScore(String testId,String questionId) {
        return iTestDao.findQuestScore(testId,questionId);
    }

    @Override
    public List<String> findDifference(String testId,String userId) {
        return iTestDao.findDifference(testId,userId);
    }
}
